#pragma once

#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_xcursor_manager.h>
#include "server.h"
#include "util.h"

enum {
    CurNormal,
    CurMove,
    CurResize
}; /* cursor */

typedef struct {
    unsigned int mod;
    unsigned int button;
    void (*func)(const Arg *);
    const Arg arg;
} Button;

typedef struct {
    /* Must be first */
    unsigned int type; /* LayerShell */
    int mapped;
    struct wlr_scene_node *scene;
    struct wl_list link;
    struct wlr_layer_surface_v1 *layer_surface;

    struct wl_listener destroy;
    struct wl_listener map;
    struct wl_listener unmap;
    struct wl_listener surface_commit;

    struct wlr_box geo;
} LayerSurface;

typedef struct Cursor
{
    Server* server;
    struct wlr_cursor *cursor;
    struct wlr_xcursor_manager *cursor_mgr;

    struct wl_listener cursor_motion;
    struct wl_listener cursor_motion_absolute;
    struct wl_listener cursor_button;
    struct wl_listener cursor_axis;
    struct wl_listener cursor_frame;
} Cursor;

Cursor* cursor_create(Server* server);
void cursor_destroy(Cursor* cursor);
